package com.lcf.task.schedule;

import cn.dev33.satoken.same.SaSameUtil;
import org.jobrunr.jobs.annotations.Job;
import org.jobrunr.jobs.annotations.Recurring;
import org.springframework.context.annotation.Configuration;

/**
 * Same-Token，定时刷新
 *
 * @author lcf
 */
@Configuration
public class SaSameTokenRefreshTask {
    /**
     * 从 0 分钟开始 每隔 5 分钟执行一次 Same-Token
     * (注意集群环境中不要多个服务重复调用)
     */
    @Job(name = "refreshSameToken")
    @Recurring(id = "refreshSameToken", cron = "*/5 * * * *")
    public void refreshToken() {
        SaSameUtil.refreshToken();
    }
}